<!DOCTYPE html>
<html>
<head>
<title>网上订单-速订客</title>
<meta ht_topp-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta ht_topp-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<meta name="keyword" content="">
<meta name="description" content="">
<link rel="stylesheet" rev="stylesheet" href="<?=STATIC_URL;?>css/base.css" type="text/css">
<link rel="stylesheet" rev="stylesheet" href="<?=STATIC_URL;?>css/order.css" type="text/css">
<link rel="icon" type="image/x-icon" href="<?=STATIC_URL;?>favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="<?=STATIC_URL;?>favicon.ico">
</head>
<body>
<?php include dirname(__FILE__).'/../com-header-sample.tpl.php'; ?>
<!------------------------------------>

<form action="/order/payment" method="post" name="submitForm" id="submitForm">
    <input type="hidden" name="shop_id" value="<?=i($shop['shop_id']);?>" />
    <input type="hidden" name="shop_name" value="<?=h($shop['name']);?>" />
    <input type="hidden" name="verify" value="<?=h($verify);?>" />
<div id="container" class="dingcan">
  <div class="order_table">
    <h2 class="navbar">菜单明细 - <a href="/shop/<?=i($shop['shop_id']);?>" style="color:#fff;font-weight:normal"><?=h($shop['name']);?></a></h2>
    <div class="box_top">
      <table class="t_top">
        <thead>
          <tr>
            <th>序号</th>
            <th>美食名称</th>
            <th>原价</th>
            <th>折扣价</th>
            <th>数量</th>
            <th>小计</th>
          </tr>
        </thead>
        <tbody id="cartTable">
<?php
    $i = $price = $money = $total = $save = 0;
    foreach($dishes as $item){
         $money = doubleval($item['number']*$item['money']); //标价
         $price = doubleval($item['number']*$item['price']); //售价（折扣后价格）
?>
          <tr id="dish_<?=$item['dish_id'];?>">
            <td><?=(++$i);?></td>
            <td><?=h($item['name']);?></td>
            <td><s><span class="money"><?=h($item['money']);?></span>元</s></td>
            <td><span class="price"><?=h($item['price']);?></span>元</td>
            <td align="center"><?=h($item['number']);?>
             <input type="hidden" name="itemNum[<?=$item['dish_id'];?>]" value="<?=h($item['number']);?>" />
             </td>
            <td><span class="count"><?=h($price);?></span></td>
          </tr>
<?php
        $total += $price;
        $save  += $money - $price;
    }
?>
        </tbody>
        <tfoot>
          <tr>
            <td colspan="7" style="border:none;height:40px;text-align:right">合计：<span id="totalfee" class="price"><?=$total;?></span> 元，节省：<span id="savefee" class="price"><?=$save;?></span> 元</td>
          </tr>
        </tfoot>
      </table>
    </div>

    <h2 class="navbar">预订信息</h2>
    <div style="background-color:#FFFFCC;padding: 10px;width:940px;" class="clear">
      <div class="last_payment_info"> <span><b>应支付：</b><span id="last_totalfee" class="price"><?=$total;?></span>元;&nbsp;&nbsp;</span>
        <span class=""> <b>共节省：</b><span id="last_savefee" class="price"><?=$save;?></span>元;&nbsp;&nbsp;</span> </div>
    </div>
    <div class="box_bot">
      <input type="hidden" name="fromtype" value="dingcan" />
      <input type="hidden" name="dosubmit" value="yes" />
      <table class="t_bot">
        <tbody>
          <tr>
            <th width="100">预订时间</th><td align="left">
            <span class="lab">
            <input type="text" name="orderdate" id="orderdate" />
            <select name="ordertime" id="ordertime">
            <option value="">...</option>
            <?php for($i=1; $i<=23; $i++){ $t = sprintf('%00d', $i);  ?>
                <option value="<?=$t;?>:00"><?=$t;?>:00</option>
                <option value="<?=$t;?>:30"><?=$t;?>:30</option>
            <?php } ?>
            </select>
            </span><span class="tip" id="orderdateTip"></span></td>
          </tr>
          <tr>
            <th width="100">人 &nbsp;&nbsp; &nbsp;&nbsp; 数</th><td align="left">
            <span class="lab">
                <label class="clear"><input type="radio" name="person" value="小桌（1-2人）" /> 小桌（1-2人）</label><br />
                <label class="clear"><input type="radio" name="person" value="中桌（3-4人）" /> 中桌（3-4人）</label><br />
                <label class="clear"><input type="radio" name="person" value="大桌（5-8人）" /> 大桌（5-8人）</label><br />
                <label class="clear"><input type="radio" name="person" value="10人以上" /> 10人以上</label>
            </span>
            <span class="tip" id="personTip"></span></td>
          </tr>
          <tr>
            <th width="100">联 系 人</th><td align="left">
            <span class="lab">
                <input type="text" name="realname" id="realname" />
                &nbsp;
                <label><input type="radio" name="gender" value="M" /> 先生</label>
                <label><input type="radio" name="gender" value="F" /> 女士</label>
            </span>
            <span class="tip" id="realnameTip"></span></td>
          </tr>
          <tr>
            <th width="100">手 &nbsp;&nbsp; &nbsp;&nbsp; 机</th><td align="left">
            <span class="lab">
                <input type="text" name="mobile" id="mobile" />
            </span>
            <span class="tip" id="mobileTip"></span></td>
          </tr>
          <tr><th width="100">&nbsp;</th><td><div class="tipinfo">重要：购买成功后将把速订客优惠券信息发送到您手机，作为去商家消费的凭证。</div></td></tr>
          <tr>
            <th width="100">支付方式</th><td align="left" class="checkout">
            <label><input id="bank_alipay" type="radio" name="pay_bank" value="alipay" checked  />
                <img src="<?=STATIC_URL;?>img/common/checkout/alipay.gif" align="absmiddle" alt="支付宝"  />&nbsp;</label>
            <label><input id="bank_tenpay" type="radio" name="pay_bank" value="tenpay" disabled  />
                <img src="<?=STATIC_URL;?>img/common/checkout/tenpay.gif" align="absmiddle" alt="财富通" style="filter:gray;-moz-opacity:.3;opacity:0.3;"  />&nbsp;</label>
            <label><input id="bank_yeepay" type="radio" name="pay_bank" value="yeepay" disabled  />
                <img src="<?=STATIC_URL;?>img/common/checkout/yeepay.gif" align="absmiddle" alt="易宝支付" style="filter:gray;-moz-opacity:.3;opacity:0.3;"  />&nbsp;</label>
<?php
    $i = 0;
    foreach($banks as $payid => $bank){
        if($i++%4 == 0){
            echo '<div class="clear"></div>';
        }
        ?><label><input id="bank_<?=$payid;?>" type="radio" name="pay_bank" value="<?=$payid;?>" />
              <img src="<?=STATIC_URL;?>img/common/checkout/<?=$bank[1];?>" align="absmiddle" alt="<?=$bank[0];?>" />&nbsp;</label>
       <?php
    }
?>
            </td>
          </tr>
        </tbody>
        <tfoot>
          <tr>
            <td colspan="3"><button class="btns" type="submit">提交订单</button></td>
          </tr>
        </tfoot>
      </table>
    </div>
    <p>&nbsp;</p>
  </div>
</div>
</form>

<!------------------------------------>
<? include dirname(__FILE__).'/../com-footer.tpl.php'; ?>
<script type="text/javascript" src="<?=STATIC_URL;?>js/jquery-1.7.1.min.js"></script>
<script src="<?=STATIC_URL;?>js/validator/formValidator-4.1.1.js" type="text/javascript" charset="UTF-8"></script>
<script src="<?=STATIC_URL;?>js/validator/formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>
<script type="text/javascript">
var onShowHtml = "";
var onFocusHtml = "<span class='$class$'>$data$</span>";
var onErrorHtml = "<span class='$class$'>$data$</span>";
var onCorrectHtml = "<span class='$class$'></span>";
var onShowClass = "inp";
var onFocusClass = "inp inp_focus";
var onErrorClass = "inp inp_error";
var onCorrectClass = "inp inp_correct";

$(document).ready(function(){
    var date = new Date();
    var minDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
    if(date.getMonth() >= 10){
        var maxDate = (date.getFullYear() + 1) + "-" + (date.getMonth() + 3) % 12 + "-" + date.getDate();
    }else{
        var maxDate = date.getFullYear() + "-" + (date.getMonth() + 3) + "-" + date.getDate();
    }

    $.formValidator.initConfig({formID:"submitForm",mode:'FixTip',onError:function(msg){/*alert(msg)*/},onSuccess:function(){return window.confirm("确认您的联系方式填写准确，以便我们及时送餐。\n现在立即提交么？");},inIframe:true,ajaxPrompt:""});
    $("#orderdate").formValidator({onShow:"请输入预订时间",onFocus:"请输入预订时间",onCorrect:"输入预订时间正确"}).inputValidator({min:minDate,max:maxDate,type:"date",onError:"日期范围" + minDate + "～" + maxDate});
    $("#realname").formValidator({onShow:"请输入联系人姓名",onFocus:"请输入联系人姓名",onCorrect:"联系人输入正确"}).inputValidator({min:2,onError:"请输入联系人姓名"});
    $("#mobile").formValidator({onShow:"请输入手机号码",onFocus:"请输入正确的手机号码，以备联络",onCorrect:"手机号码输入正确"}).inputValidator({min:11,max:11,onError:"手机号码格式错误"}).regexValidator({regExp:"mobile",dataType:"enum",onError:"你输入的电话号码格式不正确"});
    $.formValidator.reloadAutoTip();
});
</script>
</body>
</html>